package com.wing.order.model.entity;

import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.wing.cabinet.model.entity.Cabinet;
import com.wing.mybatis.common.BaseEntity;
import com.wing.platform.order.model.entity.Version;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.apache.commons.lang.StringUtils;

/**
 * 上货数量
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("ord_order_receive_load")
public class OrderReceiveLoad extends BaseEntity<OrderReceiveLoad> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum Type implements IEnum<Integer> {

        /**
         * 补货上货
         */
        replenishment(0,"补货上货"),
        /**
         * 自主上货
         */
        selfLoad(1,"自主上货"),
        selfLoadSimple(2,"自主上货"),
        selfUnloadSimple(3,"自主下货"),
        selfBatchLoadSimple(4,"自主上货"),
        selfBatchUnloadSimple(5,"自主下货"),
        returnToCab(6,"退货");

        private int code;
        private String desc;

        Type(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }

        @JsonCreator
        public static Type jsonCreator(String name) {
            if (StringUtils.isNotBlank(name)) {
                for (Type item : values()) {
                    if (item.name().equals(name.trim())) {
                        return item;
                    }
                }
            }
            return null;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 领货单id
     */
    private Long receiveId;

    /**
     * 领货明细id
     */
    private Long receiveDetailId;

    /**
     * 上货数量
     */
    private Integer quantity;

    /**
     * 柜子编码
     */
    private String cabCode;

    /**
     * 货道编号
     */
    private String spaceCode;

    /**
     * skuCode
     */
    private String skuCode;


    /**
     * 单号
     */
    private String code;

    private Integer day;

    private Integer no;

    private Type type;

    private Long cabId;

    private Long spaceId;

    private Long skuId;

    public enum CabinetType implements IEnum<Integer> {

        /**
         * 弹簧柜
         */
        spring(0,"弹簧柜"),
        /**
         * 重力柜
         */
        gravity(1,"重力柜");

        private int code;
        private String desc;

        CabinetType(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    /**
     * 刀柜类型
     */
    private Cabinet.CabinetType cabinetType;

    private String enterpriseCode;

    private String departmentName;

    private String roleName;

    /**
     * 渠道编号
     */
    private String channelCode;

    private Long departmentId;

    private Long roleId;
}
